#pragma once
#include "RedBlackTree.h"

namespace wxd
{
	template <class K,class V>
	class map
	{
	public:
		struct MapKeyOfT
		{
			K operator()(const pair<const K,V>& kv)
			{
				return kv.first;
			}
		};
		typedef typename RBTree<K, pair<const K, V>, MapKeyOfT>::Iterator iterator;
		typedef typename RBTree<K, pair<const K, V>, MapKeyOfT>::ConstIterator const_iterator;
		iterator begin()
		{
			return _rbt.Begin();
		}
		iterator end()
		{
			return _rbt.End();
		}
		const_iterator begin()const
		{
			return _rbt.Begin();
		}
		const_iterator end()const
		{
			return _rbt.End();
		}
		bool Insert(const pair<const K,V>& kv)
		{
			return _rbt.Insert(kv);
		}
	private:
		RBTree<K,pair<const K,V>,MapKeyOfT> _rbt;
		pair<const K, V> _kv;
	};

}
